package com.medusa.gruul.payment.service.handler.refund.notify;

import com.medusa.gruul.common.model.enums.PayType;
import com.medusa.gruul.payment.service.common.annotation.RefundNotifyHandler;
import com.medusa.gruul.payment.service.common.constant.WxConst;
import com.medusa.gruul.payment.service.mp.service.IPaymentRefundService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author xiaoq
 * @Description
 * @date 2022-08-08 15:32
 */
@Slf4j
@Component
@RefundNotifyHandler(PayType.WECHAT)
public class WechatRefundNotifyHandler extends AbstractRefundNotifyHandler {
    public WechatRefundNotifyHandler(IPaymentRefundService paymentRefundService) {
        super(paymentRefundService);
    }

    /**
     * 获取退款单号
     *
     * @param message 消息
     */
    @Override
    protected String refundNo(Map<String, Object> message) {
        log.debug("::::::微信退款回调::::::");
        return (String) message.get(WxConst.Refund.OUT_REFUND_NO);
    }
}
